/*
day455 
2020.11.25 
*/

#include<iostream>
#include<vector>
using namespace std;

class Solution {
public:
	int bitwiseComplement(int N) {
        int x = N;
        int count = 1;
        int tem=1;
        while(x>1){
            tem=tem<<1;
            tem=tem|1;
            x = x>>1;
        }
        int res = N ^ tem;
        return res;
    }
};

int main()
{
	Solution s;
	cout<<s.bitwiseComplement(5);
	return 0;
 } 
